#include <bits/stdc++.h>
using namespace std;
bool check(int n){
    int cnt=1;
    int ans,preans,bak=n;
    ans = preans = n&1;
    n >>= 1;
    while (n){
        ans=n & 1;
        if (ans != preans){
            if (cnt < 2) return false;
            else {
                cnt = 0;
            }
        }
        cnt++;
        preans = ans;
        n>>=1; 
    }
    while (bak > 3){
        bak >>= 1;
    }
    return (bak == 3)? true : false;
}
int main(){
    int a,b,res=0;
    cin>>a>>b;
    for (int i=a;i<=b;i++){
        if (check(i)) res++;
    }
    cout<<res;
    return 0;
}
